package com.mustafaiev.tair.cts.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;

import com.mustafaiev.tair.cts.enums.BasketType;

/**
 * @author tair
 * 
 */
@Entity
@Table(name = "baskets")
public class Basket implements ICostTrackingSystemModel {

	private static final long serialVersionUID = -2600467364620152535L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	private Long id;

	@ManyToOne
	@JoinColumn(name = "payerId")
	private Payer payer;

	private Date date;

	private BasketType type;

	@OneToMany(mappedBy = "basket", cascade = CascadeType.ALL)
	private List<Purchase> purchases;

	private String marketName;

	private String comments;

	@ManyToOne
	@JoinColumn(name = "basketsBatchId")
	private BasketsBatch basketsBatch;

	public Long getId() {
		return this.id;
	}

	public void setId(final Long id) {
		this.id = id;
	}

	public Payer getPayer() {
		return this.payer;
	}

	public void setPayer(final Payer payer) {
		this.payer = payer;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(final Date date) {
		this.date = date;
	}

	public BasketType getType() {
		return this.type;
	}

	public void setType(final BasketType type) {
		this.type = type;
	}

	public String getMarketName() {
		return this.marketName;
	}

	public void setMarketName(final String marketName) {
		this.marketName = marketName;
	}

	public String getComments() {
		return this.comments;
	}

	public void setComments(final String comments) {
		this.comments = comments;
	}

	public List<Purchase> getPurchases() {
		return this.purchases;
	}

	public void setPurchases(final List<Purchase> purchases) {
		this.purchases = purchases;
	}

	public BasketsBatch getBasketsBatch() {
		return this.basketsBatch;
	}

	public void setBasketsBatch(final BasketsBatch basketsBatch) {
		this.basketsBatch = basketsBatch;
	}

}
